<!DOCTYPE html>
<html lang="en" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('文件上传')"/>
</head>
<body style="background: white">
<div class="panel panel-default operation">
    <input id="tbbh" th:value="${tbbh}" hidden>
    <div class="panel-heading title"></div>
    <div class="layui-card-body">
        <form class="form-horizontal m" id="form-spotfile-upload">
            <input type="file" multiple="multiple" class="hide" style="display: none"/>
        </form>
        <div class="table_div">
            <table class="layui-table" id="fileList" lay-filter="fileList"></table>
        </div>
    </div>
</div>


<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="add" shiro:hasPermission="spotfile:file:upload">添加</button>
<!--        <button class="layui-btn layui-btn-sm" lay-event="batchDeleted" shiro:hasPermission="spotfile:file:delete">删除-->
<!--        </button>-->
    </div>
</script>

<script type="text/html" id="fileOperation">
    {{#  if(d.status != "success" && d.status != "starting"){ }}
    <a style="margin-left: 10px" lay-event="start" title="开始">
        <i class="fa fa-play"></i>
    </a>
    {{#  } else if(d.status == "starting") { }}
    <a style="margin-left: 10px" lay-event="pause" title="暂停">
        <i class="fa fa-pause"></i>
    </a>
    {{#  } }}

    {{#  if(d.status != "starting"){ }}
    <a style="margin-left: 10px" lay-event="delete" title="删除" shiro:hasPermission="spotfile:file:delete">
        <i class="fa fa-trash"></i>
    </a>
    {{#  } }}


    <a style="margin-left: 10px" lay-event="download" title="下载" shiro:hasPermission="spotfile:file:download">
        <i class="fa fa-cloud-download"></i>
    </a>
</script>

</body>
</html>
<script src="../layui/layui.all.js"></script>
<script src="../js/sptofile.js"></script>
<script src="../js/core.util.js"></script>
<script>
    //获取token
    var token = CoreUtil.getData("access_token");
    //地址栏转义token中的#号
    var tokenQuery = token.replace("#", "%23");
    var tableIns1;
    var table = layui.table;
    var form = layui.form;
    var layer = layui.layer;
    var $ = jQuery = layui.jquery;
    var laydate = layui.laydate;

    layui.use(['table', 'layer', 'laydate'], function () {
        Sptofile.init({
            listUrl: "/spotfile/list?tbbh=" + $("#tbbh").val(),
            uploadUrl: "/spotfile/upload"
        });
    });
</script>
